package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.service.ReissueLogisticsNoteService;
import com.ytjj.qmyx.mall.model.ReissueLogisticsNote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/reissueLogisticsNote")
public class ReissueLogisticsNoteController {

    @Autowired
    private ReissueLogisticsNoteService reissueLogisticsNoteService;

    @GetMapping("/list")
    public CommonResult selectList(@RequestParam Integer reissueLogisticsId) {
        return CommonResult.success(reissueLogisticsNoteService.selectList(reissueLogisticsId));
    }

    @PostMapping("/insertNote")
    @OperLog(operModule = "补单物流小记", operDesc = "新增", operType = SysLogConstants.OPERATION_ADD)
    public CommonResult insertNote(@RequestBody ReissueLogisticsNote reissueLogisticsNote) {
        int count = reissueLogisticsNoteService.insertNote(reissueLogisticsNote);
        if (count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }

}
